<?
$r = "../";
require_once($r."_engine/header_nocache.php");
require_once($r."_engine/c_account.php");
require_once($r."_engine/c_plan.php");
require_once($r."_config/ipn.php");



//if user logged in
if ($g_session->IsActive()) {
	$account = GetActiveAccount(false);
	$plan = new CPlan($account->data["plan_id"]);
}
$plans = CPlan::GetPlans();

$p = "plans";

include $r."_header.php";
?>

<script type="text/javascript">
<!--
var subMenuPage;
var selectedService;
var paymentMethod;
var loggedIn = false;
var isTrial = false;
var startPP;
var startWM;
var currentPlan = "<? echo $plan->id; ?>";
var selectedPlan = "<? echo $plan->id; ?>";


function setSubscrparams(){
  	var serviceID;
	var i=1;
  	while (document.getElementById('f_plan_id_'+i)){
  		if(document.getElementById('f_plan_id_'+i).checked){
			selectedPlan = document.getElementById('f_plan_id_'+i).value;

			// set PayPal params
			//startPP = document.getElementById('price_'+i).value;
			document.paypalForm.elements['a3'].value = document.getElementById('price_'+i).value;
			document.paypalForm.elements['p3'].value = document.getElementById('time_'+i).value;
			document.paypalForm.elements['t3'].value = document.getElementById('units_'+i).value;
			//document.paypalForm.elements['amount'].value = document.getElementById('price'+i).value;
			document.paypalForm.elements['item_name'].value = document.getElementById('item_name_'+i).value;
			document.paypalForm.elements['invoice'].value = document.getElementById('invoice_'+i).value;
/*
			// set Webmoney params
			startWM = document.getElementById('discount'+i).value
			document.webmoneyForm.elements['LMI_PAYMENT_AMOUNT'].value = document.getElementById('discount'+i).value;
			document.webmoneyForm.elements['LMI_PAYMENT_DESC'].value = document.getElementById('name'+i).value;
			document.webmoneyForm.elements['invoice'].value = document.getElementById('invoice'+i).value;

			// set Egold params
			startWM = document.getElementById('price'+i).value;
			document.egoldForm.elements['PAYMENT_AMOUNT'].value = document.getElementById('price'+i).value;
			document.egoldForm.elements['SUGGESTED_MEMO'].value = document.getElementById('name'+i).value;
			document.egoldForm.elements['invoice'].value = document.getElementById('invoice'+i).value;

			// set Egold params
			startCG = document.getElementById('price'+i).value;
			document.BB_BuyButtonForm.elements['item_price_1'].value = document.getElementById('price'+i).value;
			document.BB_BuyButtonForm.elements['item_name_1'].value = document.getElementById('name'+i).value;
			document.BB_BuyButtonForm.elements['item_description_1'].value = document.getElementById('name'+i).value+" | "+document.getElementById('invoice'+i).value;
			document.BB_BuyButtonForm.elements['shopping-cart_items_item-1_unit-invoice'].value = document.getElementById('invoice'+i).value;
*/
			selectedService = i; //set selected service var for not logged in users
        }
		i++;
  	}
  	//alert(document.paypalForm.elements['a3'].value+" "+document.paypalForm.elements['p3'].value+" "+document.paypalForm.elements['invoice'].value+" - "+selectedPlan)
	//alert(document.paypalForm.elements['a3'].value+" "+document.paypalForm.elements['p3'].value+" "+document.paypalForm.elements['invoice'].value);
}


function submitPaymentForm() {
	if (document.paypalForm.elements['a3'].value == 'FREE') {
		alert("Please choose payed subscription plan.");
		return false;
	}
	if (currentPlan == selectedPlan) {
		alert("You are currently subscribed to this plan!\nPlease choose another one.");
		return false;
	}

	document.getElementById(paymentMethod).submit();
}

function setPaymentMethod(){
            //paymentMethod = document.getElementsByName('method')[i].value;
			paymentMethod = 'paypalForm';

}
//-->
</script>



<? if ($g_session->IsActive()) { ?>
<p class="text">Please, choose subscription plan (your current plan is marked in bold):</p>
<? } else { ?>
<p class="text">Available subscription plans:</p>
<? } ?>

<table border="1" cellspacing="0" cellpadding="2" class="tbl" width="90%">
<tr>
	<td class="tblHTD" style="padding-left: 30;"><span class="text">Plan</td>
	<td class="tblHTD"><span class="text">Number of monitors</td>
	<td class="tblHTD"><span class="text">History Size</td>
	<td class="tblHTD"><span class="text">Cost</td>
	<td class="tblHTD"><span class="text">Period</td>
</tr>
<?php
$template_tbl_row = '
<tr [%STYLE%]>
			<td [%STYLE%]>';
if ($g_session->IsActive()) {
	$template_tbl_row .= '<input onClick="javascript:setSubscrparams();" type="radio" name="f_plan_id" id="f_plan_id_[%ITEM%]" value="[%PLAN_ID%]" [%CHECKED%] >';
}

$template_tbl_row .= '&nbsp;[%TITLE%]</td>

	<td class="tblTD"><span class="text"><center>[%MAX_MONITORS%]</center></td>
	<td class="tblTD"><span class="text"><center>[%HISTORY_SIZE%]</center></td>
	<td class="tblTD"><span class="text">[%COST%]</td>
	<td class="tblTD"><span class="text">[%PERIOD_TEXT%]
		<input type="hidden" name="item_name_[%ITEM%]" id="item_name_[%ITEM%]" value="[%TITLE%]">
		<input type="hidden" name="item_number_[%ITEM%]" id="item_number_[%ITEM%]" value="[%PLAN_ID%]">
		<input type="hidden" name="price_[%ITEM%]" id="price_[%ITEM%]" value="[%COST%]">
		<input type="hidden" name="time_[%ITEM%]" id="time_[%ITEM%]" value="[%PERIOD_L%]">
		<input type="hidden" name="units_[%ITEM%]" id="units_[%ITEM%]" value="[%PERIOD_T%]">
		<input type="hidden" name="invoice_[%ITEM%]" id="invoice_[%ITEM%]" value="[%USER%]_[%PLAN_ID%]_[%TIME%]_[%PERIOD_L%]_[%PERIOD_T%]">
	</td>
</tr>
';
$counter = 1;
foreach ($plans as $pl)
{

	$a = array(
		'TITLE'      	=> $pl->data["title"],
		'MAX_MONITORS'	=> $pl->data["max_monitors"],
		'HISTORY_SIZE'  => $pl->data["history_size"],
		'COST'     		=> ($pl->data["cost"] > 0.00 ? "$".$pl->data["cost"] : "FREE"),
		'PERIOD_TEXT'	=> $pl->GetPeriodText(),
		'USER' 			=> "",
		'CHECKED' 		=> "",
		'STYLE' 		=> ""
	);

	//if user logged in
	if ($g_session->IsActive()) {
		$a['USER'] = $account->id;
		if ($pl->id == $plan->id)
		{
			$a['CHECKED'] = "checked";
			$a['STYLE'] = "class='planSelected'";
			//foreach ($a as $k => $v){$a[$k] = "<b>" . $a[$k] . "</b>";}
		}
	}

	$a['TIME'] = time();
	$a['ITEM'] = $counter;
	$a['PLAN_ID'] = $pl->id;
	$a['PERIOD_L'] = $pl->GetPeriodL();
	$a['PERIOD_T'] = $pl->GetPeriodT();



    echo process_template($template_tbl_row, $a);
	$counter++;
}
?>
</table>

<br>

<? //if user logged in
if ($g_session->IsActive()) { ?>
<input type="button" value="Subscribe" class="button2" onClick="submitPaymentForm();" onMouseOver="this.className='button2_act'" onMouseOut="this.className='button2'">
<? } else { ?>
<p class="text">Please <a href="<?=HrefToPage("signup")?>">Sign Up</a> or <a href="<?=HrefToPage("login")?>">Login</a> first to choose a subscription plan.</p>

<?php
}

//if user logged in
if ($g_session->IsActive()) {
	$form_paypal = '
	<form action="https://www.paypal.com/cgi-bin/webscr" name="paypalForm" id="paypalForm" method="post">
	<input type="hidden" name="cmd" value="_xclick-subscriptions">
	<input type="hidden" name="business" value="'.$ipn_paypal_business.'">
	<input type="hidden" name="item_name" value="[%TITLE%]">
	<input type="hidden" name="item_number" value="[%ID%]">
	<input type="hidden" name="no_shipping" value="1">
	<input type="hidden" name="return" value="'.$ipn_paypal_return.'" />
	<input type="hidden" name="rm" value="2" />
	<input type="hidden" name="cancel_return" value="'.$ipn_paypal_cancel_return.'" />
	<input type="hidden" name="notify_url" value="'.$ipn_paypal_notify_url.'">
	<input type="hidden" name="a3" value="[%COST%]">
	<input type="hidden" name="p3" value="[%PERIOD_L%]">
	<input type="hidden" name="t3" value="[%PERIOD_T%]">
	<input type="hidden" name="no_note" value="1" />
	<input type="hidden" name="invoice" value="" />
	<input type="hidden" name="currency_code" value="USD" />
	<input type="hidden" name="modify" value="0">
	<input type="hidden" name="usr_manage" value="0" />

	</form>';

	$a = array(
		'ID'	      	=> $plan->id,
		'TITLE'      	=> $plan->data["title"],
		'COST'     		=> $plan->data["cost"],
		'PERIOD_L'		=> $plan->GetPeriodL(),
		'PERIOD_T'		=> $plan->GetPeriodT(),
	);

	echo process_template($form_paypal, $a);
}

?>


<script type="text/javascript">
<!--
setSubscrparams();
setPaymentMethod('paypal');

//-->
</script>



				<table width="100%">
					<tr>
						<td align="center" valign="bottom">
							<table width="160" cellspacing="0" cellpadding="0" border="0"  >
								<tr>
									<td valign="top"><img src="/images/pricing/win_top_left.jpg" border="0" width="16" height="47" alt=""></td>
									<td valign="center" align="center" style="background-image: url(/images/pricing/win_1_title.jpg); width:131px; height:47px;"  class="pricing">
									    <b>Individual</b><br /> $24.95 / Month
									</td>
									<td valign="top"><img src="/images/pricing/win_top_rt.jpg" border="0" width="13" height="47" alt=""></td>
								</tr>
								<tr>
									<td valign="top" background="/images/pricing/win_left_bg.jpg" width="16"></td>
									<td valign="top" align="left" width="131" bgcolor="#E7E7E7" class="list" >
										-&nbsp; Quantity of monitors: 30<br />
										-&nbsp; Tracking freq.: Daily<br />
										-&nbsp; Email alerts<br />
										-&nbsp; RSS tracking & output<br />
										-&nbsp; Browser plug-in<br />
										<p class="price_text">
										For individual professionals or startup businesses
										who want continually monitor public information sources 

										</p>
                       										
															<br><br>
															<a href=""><img src="/images/pricing/btn_signupchart_large.png" border="0" width="76" height="30" alt=""></a><br>
															
									</td>
									<td valign="top" background="/images/pricing/win_rt_bg.jpg" width="13"></td>
								</tr>
								
								<tr>
									<td colspan="3" background="/images/pricing/106_36.jpg" height="56">
									&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src="/images/pricing/price.jpg" border="0" width="58" height="27" alt="">							</td>
								</tr>
							</table>
						</td>
						<td align="center" valign="bottom">
								<table width="160" cellspacing="0" cellpadding="0" border="0"  >
								<tr>
									<td valign="top"><img src="/images/pricing/win_top_left.jpg" border="0" width="16" height="47" alt=""></td>
									<td valign="center" align="center" style="background-image: url(/images/pricing/win_1_title.jpg); width:131px; height:47px;"  class="pricing">
									    <b>Team</b><br /> $39.95 / Month
									</td>
									<td valign="top"><img src="/images/pricing/win_top_rt.jpg" border="0" width="13" height="47" alt=""></td>
								</tr>
								<tr>
									<td valign="top" background="/images/pricing/win_left_bg.jpg" width="16"></td>
									<td valign="top" align="left" width="131" bgcolor="#E7E7E7" class="list" >
									
									
										<p><b>Individual plus</b></p>


											-&nbsp; Quantity of monitors: 60<br />
											-&nbsp; Tracking freq.: Hourly<br />
											-&nbsp; Multiple emails/groups<br />
											-&nbsp; Stealth mode<br />
											-&nbsp; SMS notifications<br />
											<p class="price_text">
										   For small businesses and groups of professionals who cares 
										   about its media reputation monitoring and want always to be on track with market trends


											</p>
                       										
															<br><br>
															<a href=""><img src="/images/pricing/btn_signupchart_large.png" border="0" width="76" height="30" alt=""></a><br>
															
									</td>
									<td valign="top" background="/images/pricing/win_rt_bg.jpg" width="13"></td>
								</tr>
								
								<tr>
									<td colspan="3" background="/images/pricing/106_36.jpg" height="56">
									&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src="/images/pricing/price.jpg" border="0" width="58" height="27" alt="">							</td>
								</tr>
							</table>
						</td>
						<td align="center" valign="bottom">
								<table width="160" cellspacing="0" cellpadding="0" border="0"  >
								<tr>
									<td valign="top"><img src="/images/pricing/win_top_left.jpg" border="0" width="16" height="47" alt=""></td>
									<td valign="center" align="center" style="background-image: url(/images/pricing/win_1_title.jpg); width:131px; height:47px;" class="pricing">
									    <b>Professional</b><br /> $945.95 / Year

									</td>
									<td valign="top"><img src="/images/pricing/win_top_rt.jpg" border="0" width="13" height="47" alt=""></td>
								</tr>
								<tr>
									<td valign="top" background="/images/pricing/win_left_bg.jpg" width="16"></td>
									<td valign="top" align="left" width="131" bgcolor="#E7E7E7" class="list" >
									
									
										<p><b>Team plus</b></p>

											-&nbsp; Quantity of monitors: 120<br />
											-&nbsp; Hidden Web<br />
											-&nbsp; General Account Mngr.<br />
											-&nbsp; Stealth mode<br />
											-&nbsp; Monitor&rsquo;s credits<br />
										   
											
											<p class="price_text">
										   For small-to-medium businesses whose business is strongly rely on their products&rsquo;  
										   branding and want to increase  customer&rsquo;s satisfaction in the most sufficient way  <br />
											<br />
											<br />
										   <br />
											<br />

											</p>
                       										
															
															
															<a href=""><img src="/images/pricing/btn_signupchart_large.png" border="0" width="76" height="30" alt=""></a><br>
															
									</td>
									<td valign="top" background="/images/pricing/win_rt_bg.jpg" width="13"></td>
								</tr>
								
								<tr>
									<td colspan="3" background="/images/pricing/106_36.jpg" height="56">
									&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src="/images/pricing/price.jpg" border="0" width="58" height="27" alt="">							</td>
								</tr>
							</table>
						</td>
					</tr>
					
					

				</table>




<p><b>Hosted Edition</b><br />
Interested to host W3Monitor in your own data-center? <a href="/company/contact.php">Contact</a> us for the details.</p>

<p><b>Browser plug-in</b><br />
Coming soon.</p>



<?
include $r."_footer.php";
?>